home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 12
/
012.d81
/
three deep
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
1KB
|
43 lines
7000 rem alpha order by distr counting-3 deep*by tom foster*
7001 print:print:print:print"please wait about 1 minute while";
7003 print" the file is alphabetized. *thank you* "
7010 dimr(26),aa$(300),bb$(300),cc(300)
7020 fori=1tot:l=asc(mid$(a$(i),3,1))-64
7025 ifl=-32thenl=0
7030 r(l)=r(l)+1
7035 next
7040 fork=1to26:r(k)=r(k)+r(k-1):next
7045 forj=tto1step-1:l=asc(mid$(a$(j),3,1))-64
7050 ifl=-32thenl=0
7055 i=r(l):aa$(i)=a$(j):bb$(i)=b$(j):cc(i)=c(j)
7057 r(l)=i-1
7058 next
7060 fori=1tot:printaa$(i):next:rem * if you want to see first cycle *
7101 print:print:print"it won't be long now"
7110 dimrb(26),ab$(300),bc$(300),cd(300)
7120 fori=1tot:lb=asc(mid$(aa$(i),2,1))-64
7125 iflb=-32thenlb=0
7130 rb(lb)=rb(lb)+1
7135 next
7140 forkb=1to26:rb(kb)=rb(kb)+rb(kb-1):next
7145 forjb=tto1step-1:lb=asc(mid$(aa$(jb),2,1))-64
7150 iflb=-32thenlb=0
7155 i=rb(lb):ab$(i)=aa$(jb):bc$(i)=bb$(jb):cd(i)=cc(jb)
7157 rb(lb)=i-1
7158 next
7160 fori=1tot:printaa$(i):next:rem * if you want to see second cycle *
8001 print:print:print"i'm almost finished."
8010 dims(26),ac$(300),bd$(300),ce(300)
8020 fori=1tot:m=asc(ab$(i))-64
8025 ifm=-32thenm=0
8030 s(m)=s(m)+1
8035 next
8040 forkk=1to26:s(kk)=s(kk)+s(kk-1):next
8045 forjj=tto1step-1:m=asc(ab$(jj))-64
8050 ifm=-32thenm=0
8055 i=s(m):ac$(i)=ab$(jj):bd$(i)=bc$(jj):ce(i)=cd(jj)
8057 s(m)=i-1
8058 next
8060 fori=1tot:printac$(i):next:rem * if you want to see final cycle *
8070 return